package com.daiqee.el;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * 解析json,EL
 * 
 * <br/>
 * @since JDK 1.8
 * @version  V2.1
 * @author RichardTang 
 * @date: 2018年5月7日 下午5:49:41
 * @package com.daiqee.el
 * @copyright:Copyright (c) 2018, 1245811923@qq.com All Rights Reserved.
 */
public class ElFunctions {
	
	/**
	 * 吧java对象转换成json字符串
	 * @param obj
	 * 			需要给转换的对象
	 * @return 转换好的字符窜
	 */
	public static String toJsonString(Object obj){
		ObjectMapper mapper = new ObjectMapper();
		String jsonStr = "";
		try {
			jsonStr = mapper.writeValueAsString(obj);
		} catch (JsonProcessingException e) {
			e.printStackTrace();
		}
        return jsonStr;
    }
	
}
